__author__ = 'SIOM'
'''
%Profile_R = 105.987;
%Empty_R = 70.950;
%Lens_R = 35.5;
%Lens_Profile_R = 39;
%Sensor_R = 6.5/2;

%Sensor_angle_1 = 20;
%Sensor_angle_2 = 57;
%Sensor_angle_3 = 123;
%Sensor_angle_4 = 157;

Profile_R = 125;
Empty_R = 88;
Lens_R = 34;
Lens_Profile_R = 38;
Sensor_R = 6.5/2;

Sensor_angle_1 = 30;
Sensor_angle_2 = 60;
Sensor_angle_3 = 120;
Sensor_angle_4 = 150;
'''
import math
import matplotlib.pyplot as plt
from matplotlib.patches import Circle
from pylab import figure, show, rand
#import numpy as np
#import ComputerForDOE

#sensor1 = circle(3,0,4)
c = Circle((0,1),1.5/2,fc="1", ec="r", lw=1)
d = Circle((0,2),1.5/2,fc="1",ec = "b",lw =1)
profile_R = 125;
empty_R = 88;
lens_R = 34;
lens_Profile_R = 38;
sensor_R = 6.5/2;

Sensor_angle_1 = 30;
Sensor_angle_2 = 60;
Sensor_angle_3 = 120;
Sensor_angle_4 = 150;
def computer_center(cartesian_xy,relative_r,relative_angle):
    x = cartesian_xy[0] + relative_r*math.cos(relative_angle/360*2*math.pi)
    y = cartesian_xy[1] + relative_r*math.sin(relative_angle/360*2*math.pi)
    return (x,y)

class  DOE:
    baseOfSensor = Circle(computer_center((0,0),empty_R,270),profile_R)
    baseOfChip = Circle(computer_center((0,0),empty_R,0),profile_R)
    sensor = [Circle(xy=rand(2)*10,radius=rand())
        for i in xrange(10)]
    chip = [Circle(xy = rand(2)*10,radius=rand())
        for i in xrange(10)]
    """
    turntable = mpatches.Circle()
    sensor2 = mpatches.Circle()
    sensor4 = mpatches.Circle()
    sensor6 = mpatches.Circle()
    sensor8 = mpatches.Circle()
   #sensor5 = mpatches.Circle()
    chip2 = mpatches.Circle()
    chip4 = mpatches.Circle()
    chip6 = mpatches.Circle()
    chip8 = mpatches.Circle()
    turntable_move_center =mpatches.Circle()
    turntable_move_center.center = computer_center(0,0,88,270)
    #chip5 = mpatches.Circle()
    """
def circle_area(a):
    circle_area = math.pi*a.radius**2
    return circle_area
ax = plt.subplot(111, aspect=1)
DOE.baseOfChip.set_alpha(0.1)
DOE.baseOfSensor.set_alpha(0.2)
ax.add_patch(DOE.baseOfChip)
ax.add_patch(DOE.baseOfSensor)
ax.add_patch(DOE.sensor[0])
#plt.text()
plt.xlim(-3000,3000)
plt.ylim(-3000,3000)
plt.show()
print(circle_area(c))